<%@page language="java"%>
<%@page contentType="text/html"%>
<%@page import="java.util.*, descriptor.*"%>

<jsp:include page="admin_generic_pre.jsp" >
	<jsp:param name="pagesubtitle" value="Create/Update a Degree" />
</jsp:include>

	<p>
		<jsp:useBean id="infos" class="java.lang.String" scope="request" />
		<%= infos %>
	</p>
	<p>
		<jsp:useBean id="degree" class="descriptor.DegreeDescriptor" scope="request" />
		<jsp:useBean id="departments" class="descriptor.DepartmentsListDescriptor" scope="request" />
		<form method="POST" action="admin">
			<table>
				<tr><td>Name: </td><td><input type="text" name="name" value="<%= degree.getName() %>" /></td></tr>
				<tr><td>Infos: </td><td><textarea rows="5" cols="10" name="degreeInfos"><%= degree.getInfos() %></textarea></td></tr>
				<tr>
					<td>Department: </td>
					<td>
						<select name="departmentId">
							<% for (DepartmentDescriptor dd : departments.getDepartmentDescriptors()) {%>
								<option value="<%= dd.getId()%>" <%if (dd.getId() == degree.getDepartmentId()){%>selected="selected"<%}%> ><%= dd.getName()%></option>
							<% } %>
						</select>
					</td>
				</tr>
			</table>
			<input type="hidden" name="degreeId" value="<%= degree.getId() %>" />
			<input type="hidden" name="action" value="degrees_createupdate" />
			<input type="submit" name="button_createupdate" value="Create/Update" />
		</form>
	</p>
	
	
<jsp:include page="admin_generic_post.jsp" ></jsp:include>